import {defineStore} from "pinia";
import {MenuTree} from "../type/MenuTree.ts";


export const MainStore = defineStore('mainStore', {

    state: () => {

        return {
            isLogin: false,
            asyncRoutesMark: false,
            userRoleIds: [] as Number[]
        }
    },

    actions: {
        getMenuTree(): MenuTree[] {

            const json = sessionStorage.getItem('menu')

            if (json != null){
                return  JSON.parse(json) as MenuTree[]
            }

            return []
        }
    }
})
